package com.shujia.wyh.regulardemo;

public class RegularDemo9 {
    public static void main(String[] args) {
        //日期案例
        // 2022-03-28  ---> 03/28/2022  $2/$3/$1
        String regex = "(\\d{4})-(\\d{2})-(\\d{2})";
        String str = "2022-03-28 dasdas 2022-04-05";
        System.out.println(str.replaceAll(regex,"$2/$3/$1"));

        //需求2：我不想你取出月份
        regex = "(\\d{4})-(?:\\d{2})-(\\d{2})";
        System.out.println(str.replaceAll(regex,"$2/$1"));
    }
}
